Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Determining and Changing the Status of the System Alert Sound

The enhanced Sound Manager includes two routines-- SndGetSysBeepState and SndSetSysBeepState --that allow you to determine and alter the status of the system alert sound. You might wish to disable the system alert sound if you are playing sound and need to ensure that the sound you are playing is not interrupted. Currently, two states are defined:

CONST
    sysBeepDisable              = $0000;        {system alert sound disabled}
    sysBeepEnable               = $0001;        {system alert sound enabled}

You can determine the status of the system alert sound like this:

SndGetSysBeepState(currentState);

And you can disable the system alert sound like this:

myErr := SndSetSysBeepState(sysBeepDisable);

When the system alert sound is disabled, the Sound Manager effectively ignores all calls to the SysBeep procedure. No sound is created and the menu bar does not flash. Also, no resources are loaded into memory.

Even when the system alert sound is enabled, it's possible that the system alert sound will not play; for example, the speaker volume might be set to 0, or playing the requested system alert sound might require too much CPU time. In such a case, the menu bar flashes.

By default, the system alert sound is enabled. If you disable the system alert sound so that your application can play a sound without being interrupted, be sure to enable the sound when your application receives a suspend event or when the user quits your application.


© 1998 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |